#include "ReconstructByKinectCommon.h"
#include <vector>

std::vector< SensorDataKinectInput * > g_sensorPtrs;

int main ()
{
	OpenNIContextManager contextManager;
	SensorDataKinectInput *pSensor;
	int i = 0;
	char strIndex[2]; 
	while (true) {
		itoa (i, strIndex, 10);
		pSensor = contextManager.createSensor (
				std::string ("Sensor ") + strIndex);
		if (pSensor == NULL)
			break;
		g_sensorPtrs.push_back (pSensor);
		++i;
	}
	contextManager.start ();
	while (true) {
		contextManager.update ();
		for (int i = 0; i < g_sensorPtrs.size (); ++i) {
			g_sensorPtrs[i]->getNewFrame ();
			g_sensorPtrs[i]->showData ("Preview - ");
		}
		int key = cvWaitKey (10);
		if (key == 27)
			break;
	}

	for (int i = 0; i < g_sensorPtrs.size (); ++i)
		delete g_sensorPtrs[i];
	return 0;
}